Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Fix getattr clalback on dynamic modules #2855

Merged
merged 1 commit into from
Mar 10, 2022

Conversation

iLLiCiTiT
Copy link
Member

Brief description

Calling getattr on dynamic modules in openpype (openpype_modules and openpype_interfaces) does not behave as expected because is raising ImportError instead of AttributeError.

Changes

  • dynamic module has __name__ attribute (where is stored it's name)
  • __getattr__ method raises AttributeError instead of ImportError

Testing notes:

Run script in python interpreter console

import openpype_modules

# This should return None and not crash
getattr(openpype_modules, "missing_module", None)

@iLLiCiTiT iLLiCiTiT self-assigned this Mar 9, 2022
@iLLiCiTiT iLLiCiTiT added the type: bug Something isn't working label Mar 9, 2022
@iLLiCiTiT iLLiCiTiT merged commit 2f0985d into develop Mar 10, 2022
@iLLiCiTiT iLLiCiTiT deleted the bugfix/geattr_on_dynamic_module branch March 10, 2022 08:33
@mkolar mkolar added this to the 3.9.0 milestone Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants